library SystemInit

    // 给友军注册贩卖单位事件
    function TriggerRegisterFriendlySellEventFF takes trigger trig returns nothing
        call TriggerRegisterPlayerUnitEvent(trig, Player(PLAYER_NEUTRAL_PASSIVE), EVENT_PLAYER_UNIT_SELL, null)
    endfunction
    
    // 给敌对玩家注册事件
    function TriggerRegisterEnemyUnitEventFF takes trigger whichTrigger, playerunitevent whichPlayerUnitEvent returns nothing
        call TriggerRegisterPlayerUnitEvent(whichTrigger, Player(PLAYER_NEUTRAL_AGGRESSIVE), whichPlayerUnitEvent, null)
        call TriggerRegisterPlayerUnitEvent(whichTrigger, Player(5), whichPlayerUnitEvent, null)
        call TriggerRegisterPlayerUnitEvent(whichTrigger, Player(6), whichPlayerUnitEvent, null)
    endfunction

    // 给友军注册事件(只包括玩家单位)
    function TriggerRegisterFriendlyUnitEventFF takes trigger whichTrigger, playerunitevent whichPlayerUnitEvent returns nothing
        call TriggerRegisterPlayerUnitEvent(whichTrigger, Player(0), whichPlayerUnitEvent, null)
        call TriggerRegisterPlayerUnitEvent(whichTrigger, Player(1), whichPlayerUnitEvent, null)
        call TriggerRegisterPlayerUnitEvent(whichTrigger, Player(2), whichPlayerUnitEvent, null)
        call TriggerRegisterPlayerUnitEvent(whichTrigger, Player(3), whichPlayerUnitEvent, null)
    endfunction

    // 给玩家注册聊天事件
    function TriggerRegisterPlayerChatEventFF takes trigger whichTrigger, string chatMessageToDetect, boolean exactMatchOnly returns nothing
        local integer uid = 0
        loop
            exitwhen uid > PLAYER_NUMBER
            call TriggerRegisterPlayerChatEvent(whichTrigger, Player(uid), chatMessageToDetect, exactMatchOnly)
            set uid = uid + 1
        endloop
    endfunction
endlibrary
